package com.example.parkdemo.repair

import androidx.lifecycle.MutableLiveData
import com.example.base.mvvm.BaseViewModel
import com.example.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject

@HiltViewModel
class RepairViewModel @Inject constructor(
    val apiService: ApiService
) : BaseViewModel() {
    val getAllSuccess by lazy { MutableLiveData<String>() }
    fun getAll() {
        executeNetWork(
            { apiService.getAllRepair() }, getAllSuccess::postValue
        )
    }

    val getAddSuccess by lazy { MutableLiveData<String>() }
    fun getAddRepair(body: RequestBody) {
        executeNetWork(
            { apiService.addRepair(body) }, getAddSuccess::postValue
        )
    }
}